package com.jintian.smart.platform.system.provider;

import com.jintian.smart.base.api.system.entity.DepartmentEntity;
import com.jintian.smart.base.api.system.provider.IDepartmentProvider;
import com.jintian.smart.base.api.system.view.DepartmentVO;
import com.jintian.smart.platform.system.service.DepartmentService;
import org.apache.dubbo.config.annotation.DubboService;

import java.util.List;

@DubboService(timeout = 6000)
public class DepartmentProvider implements IDepartmentProvider {
    private DepartmentService departmentService;

    /**
     * 自身以及所有下级的部门id列表
     */
    @Override
    public List<Long> selfAndChildrenIdList(Long departmentId) {
        return departmentService.selfAndChildrenIdList(departmentId);
    }

    /*
     *  根据主键批量获取部门信息
     */
    @Override
    public List<DepartmentEntity> listByIds(List<?> idList) {
        return departmentService.listByIds(idList);
    }

    /**
     * 获取部门
     */
    @Override
    public DepartmentVO getDepartmentById(Long departmentId) {
        return departmentService.getDepartmentById(departmentId);
    }

    /**
     * 获取部门路径：/公司/研发部/产品组
     */
    @Override
    public String getDepartmentPath(Long departmentId) {
        return departmentService.getDepartmentPath(departmentId);
    }
}
